package nc;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * 统计投票
 */
public class Q21317 {

    public static class TpSystem {

        private Map<String, Integer> count = new LinkedHashMap<>();

        static String INVALID = "Invalid";

        public void init(String names) {
            count.clear();
            for (String s : names.split(" ")) {
                count.put(s, 0);
            }
            count.put(INVALID,0);
        }

        public void vote(String names) {
            for (String name : names.split(" ")) {
                final Integer integer = count.get(name);
                if (integer == null) {
                    count.put(INVALID,count.get(INVALID) +1);
                } else {
                    count.put(name, integer + 1);
                }
            }

        }

        public void out(){
            for (Map.Entry<String, Integer> entry : count.entrySet()) {
                System.out.println(entry.getKey() + " : " + entry.getValue());
            }
        }

    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            final TpSystem tpSystem = new TpSystem();
            int hxrNum = Integer.parseInt(scanner.nextLine());
            String names = scanner.nextLine();
            tpSystem.init(names);
            scanner.nextLine();
            tpSystem.vote(scanner.nextLine());
            tpSystem.out();
        }
    }

}
